import { h } from 'vue';
import { NTag } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '序号',
    key: 'id',
    align: "center",
  }, {
    title: '会员ID',
    key: 'user_id',
    align: "center",
  }, {
    title: '会员名称',
    key: 'nick_name',
    align: "center",
  }, {
    title: '属性',
    key: 'attr',
    align: "center",
    render(row) {
      if (row.attr == 1) {
        return h(
          NTag,
          {
            type: 'info',
          },
          {
            default: () => ('代理'),
          },
        );
      } else if (row.attr == 2) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('商家'),
          },
        );
      }
    }
  }, {
    title: '姓名',
    key: 'name',
    align: "center",
  }, {
    title: '联系电话',
    key: 'tell',
    align: "center",
  }, {
    title: '创建时间',
    key: 'create_time',
    align: "center",
  }, {
    title: '处理状态',
    key: 'status',
    align: "center",
    render(row) {
      if (row.status == 0) {
        return h(
          NTag,
          {
            type: 'error',
          },
          {
            default: () => ('未处理'),
          },
        );
      } else if (row.status == 1) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('已处理'),
          },
        );
      }
    }
  }
];
